﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using FA.Library.Sim.Events;
using FA.Library.Sim;
using FA.Library.Sim.Aircraft;

namespace FA.Library.Plugin
{
    public interface IPlugin : IDisposable
    {
        #region Events

        /// <summary>
        /// The Simulator settings have changed.
        /// </summary>
        event EventHandler OnPluginSettingsChangedEvent;

        /// <summary>
        /// The plugin is disposed.
        /// </summary>
        event EventHandler Disposed;

        /// <summary>
        /// The plugin was started.
        /// </summary>
        event EventHandler OnPluginStartEvent;

        /// <summary>
        /// The plugin was stopped.
        /// </summary>
        event EventHandler OnPluginStopEvent;

        /// <summary>
        /// The simulator has sent a message.
        /// </summary>
        event SimMessageEvent OnSimMessageEvent;

        /// <summary>
        /// The simulator has encountered an exception.
        /// </summary>
        event SimExceptionEvent OnSimExceptionEvent;

        /// <summary>
        /// The aircraft model has changed on the simulator.
        /// </summary>
        event SimAircraftModelChangedEvent OnSimAircraftModelChangedEvent;

        #endregion

        /// <summary>
        /// The name of this plugin instance.
        /// </summary>
        string Name { set; get; }

        /// <summary>
        /// The aircraft of the plugin.
        /// </summary>
        AircraftModel AircraftModel { get; }

        /// <summary>
        /// Indicates if the plugin is running.
        /// </summary>
        bool IsRunning { get; }

        /// <summary>
        /// Indicates if the plugin has been disposed.
        /// </summary>
        bool IsDisposed { get; }

        /// <summary>
        /// Initialise the plugin.
        /// </summary>
        void Initialise();

        /// <summary>
        /// Start the plugin.
        /// </summary>
        void Start();

        /// <summary>
        /// Stop the plugin.
        /// </summary>
        void Stop();

        /// <summary>
        /// Update the settings 
        /// </summary>
        /// <param name="settings"></param>
        void UpdateSettings(Dictionary<string, string> settings);

        /// <summary>
        /// Get settings for this plugin instance.
        /// </summary>
        Dictionary<string, string> GetSettings();

        /// <summary>
        /// Update the aircraft model for the plugin.
        /// </summary>
        /// <param name="model"></param>
        void UpdateAircraftModel(AircraftModel model, bool supressEvent);
    }
}